# 编辑异步任务代码
import logging

from celery_tasks.sms.yuntongxun.sms import CCP
from celery_tasks.sms import constants

from celery_tasks.main import celery_app

logger = logging.getLogger('django')


# @celery_app.task(name='send_sms_code')  给任务起别名，如果不用，则使用函数名
@celery_app.task(name='send_sms_code')
def send_sms_code(mobile, sms_code):
    """
    发送短信验证码的异步任务
    :param mobile:手机号
    :param sms_code:验证码
    :return:
    """
    msg = f'验证码{sms_code}已发送到{mobile}'
    logger.info(msg)
    # CCP().send_template_sms(mobile, [sms_code, constants.SMS_CODE_REDIS_EXPIRES // 60], 1)
